﻿using System;
using PgBirdie.Core.Extensions;
using PgBirdie.Core.Model.Database.Structure.Index;

namespace PgBirdie.Core.Service.DbObject
{
    public class DbObjectValidator : IDbObjectValidator
    {
        public void ValidateIndex(PgIndex index)
        {
            if (index == null)
                throw new Exception("Index was null or empty.");
            if (String.IsNullOrEmpty(index.Name))
                throw new Exception("Index name was null or empty.");
            if (index.Columns.IsNullOrEmpty())
                throw new Exception("Index columns was null or empty.");
        }
    }
}